/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-01-12 09:35:49
 * @LastEditTime : 2023-06-27 13:52:29
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\TwoRouter\Organization.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { DelDataButton, AddDataButton, AnnexButton } from '../Common/options'
import { EnumComments } from '../Common/Conversion'

export const SecurityActivityAnnexTwo = async ({ OptionsEvent, oneData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        hideInSearch: true,
        params: { SecurityActivityUuid: oneData.uuid },
        initialValues: { securityActivityUuid: oneData.uuid, securityActivityAttachmentType: 4 },
        get: API_LIST([oneData.uuid])['getSecurityActivityAttachment'],
        added: 'posSecurityActivityAttachment',
        options: [<AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="添加附件" />],
        columns: [
            commonTableList.uuid,
            {
                dataIndex: 'securityActivityUuid',
                title: 'securityActivityUuid',
                valueType: 'hidden',
                hideInTable: true,
            },
            { ...commonTableList.tableName, title: '附件主题' },
            {
                dataIndex: 'securityActivityAttachmentType',
                title: 'securityActivityAttachmentType',
                valueType: 'hidden',
                hideInTable: true,
            },
            {
                dataIndex: 'attachmentUuid',
                title: '文件附件',
                valueType: 'upload',
                valueFile: [1, 2, 3, 4, 5],
                fileUrl: 'fileUrl',
                rules: true,
                hideInTable: true,
            },
            {
                dataIndex: 'fileUrl',
                title: '文件附件',
                valueType: 'hidden',
                hideInSearch: true,
                hideInTable: true,
                hideInAdded: true,
                hideInModify: true,
                width: 400,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 220,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <AnnexButton
                            OptionsEvent={OptionsEvent}
                            key="see"
                            url={record.attachment.fileUrl}
                            title="附件详情"
                        />,
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url="SecurityActivityAttachment"
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }
    return data
}
